<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Model\SoftDeletes;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property string $deleted_at 删除时间
 * @property string $nickname 用户昵称
 * @property string $name 姓名
 * @property int $gender 性别1男2女
 * @property string $avatar 用户头像
 * @property string $signed 个人签名
 * @property string $birthday 生日
 * @property string $province 
 * @property string $city 
 * @property string $district 
 * @property string $address 住址
 * @property int $height 身高
 * @property int $weight 体重
 * @property string $qualification 学历
 * @property string $work 职业
 * @property int $user_id 用户id
 * @property string $lang 
 * @property-read null|Account $account 
 */
class AccountInfo extends MineModel
{
    use SoftDeletes, FileTrait;

    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'account_info';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'deleted_at', 'nickname', 'name', 'gender', 'avatar', 'signed', 'birthday', 'province', 'city', 'district', 'address', 'height', 'weight', 'qualification', 'work', 'user_id', 'lang'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'gender' => 'integer', 'height' => 'integer', 'weight' => 'integer', 'user_id' => 'integer'];

    public function account(): HasOne
    {
        return $this->hasOne(Account::class, 'gene_id', 'user_id');
    }
}
